import Taro, { Component } from '@tarojs/taro'
import { ScrollView, View } from '@tarojs/components'
import './index.scss'
import classNames from 'classnames'
import { GoodsFourItem } from '@/components/index'

interface IProps {
  list: any
  className?: string
}

export default class GoodsFourList extends Component<IProps, {}> {
  props: any

  static options = {
    addGlobalClass: true
  }

  render() {
    const { list=[], className }:any = this.props
    const last = list.length - 2
    return (<ScrollView scrollX className='goods-four-scroll'>
      <View className={classNames('goods-four-list', className)}>
        {list.map((goods, key) => {
          return (<GoodsFourItem key={goods.id} info={goods} className={classNames(last < key && '^goods-four-list__last')}/>)
        })}
      </View>
    </ScrollView>)
  }
}
